﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="edit.aspx.cs" Inherits="EnmineKaitlin.admin.edit" MasterPageFile="~/MasterPage/AdminDefault.Master" %>
<%@ Register src="../Common/DropDowListCategory.ascx" tagname="DropDowListCategory" tagprefix="ucddlc" %>
<%@ Register Assembly="EnmineKaitlin" Namespace="EnmineKaitlin.Common" TagPrefix="Pagging" %>
<asp:Content ID="ctnedit" runat="server" ContentPlaceHolderID="cphContent">
    <div class="form list">
        <h2><span class="icon"><img src="../images/admin/Play.png"></span><asp:Label ID="lblFunction" runat="server"></asp:Label></h2>
        <div class="content">
            <div class="filter">                
                <div class="filter-item left">
                    <p>Từ khóa:&nbsp;<asp:TextBox ID="txtKeyWord" Value="Nhập từ khóa" runat="server" CssClass="txt txtsearch"></asp:TextBox></p>
                </div>
                <asp:Panel ID="pnlCategory" runat="server">
                <div class="filter-item left">
                    <p>Chuyên mục:&nbsp;<asp:DropDownList ID="ddlCategoryFilter" runat="server" AppendDataBoundItems="true"></asp:DropDownList></p>
                </div>
                </asp:Panel>
                <div class="filter-item left">
                    Trạng thái:&nbsp;
                    <asp:DropDownList ID="ddlStatus" runat="server">
                        <asp:ListItem Text="Tất cả" Value=""></asp:ListItem>
                        <asp:ListItem Text="Xuất bản" Value="publish"></asp:ListItem>
                        <asp:ListItem Text="Chờ duyệt" Value="pending"></asp:ListItem>
                        <asp:ListItem Text="Dự thảo" Value="draft"></asp:ListItem>
                    </asp:DropDownList>
                </div>
                <div class="filter-item left">
                    Ngôn ngữ: <asp:DropDownList ID="ddlLanguage" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlLanguage_SelectedIndexChange">
                        <asp:ListItem Text="Tiếng Việt" Value="vn"></asp:ListItem>
                        <asp:ListItem Text="English" Value="en"></asp:ListItem>
                    </asp:DropDownList>
                    &nbsp;&nbsp;&nbsp;&nbsp;<asp:LinkButton ID="btnFilter" Text="Lọc bài viết" runat="server" CssClass="link-btn" CommandName="Filter" OnCommand="btnFilter_Command"></asp:LinkButton>
                </div>                                
            </div>                    
            <div class="function">
                <asp:DropDownList ID="ddlFunctionTop" runat="server" CssClass="select">
                    <asp:ListItem Selected="True" Text="Chọn thao tác" Value=""></asp:ListItem>
                    <asp:ListItem Text="Xóa" Value="delete"></asp:ListItem>
                </asp:DropDownList>
                <asp:LinkButton ID="lbtFunction" runat="server" Text="Thực hiện" CssClass="link-btn" CommandName="BunkFunction" OnCommand="lbtFunction_Click" CommandArgument="TopFunction"></asp:LinkButton>	            
            </div>    
            <asp:GridView ID="grvPost" runat="server" Width="100%"
             AutoGenerateColumns="false" DataKeyNames="PostID" CssClass="tbl-list" AlternatingRowStyle-BackColor="AntiqueWhite"
             OnRowDataBound="grvPost_RowDataBound" onrowdeleting="grvPost_RowDeleting" >             
                <Columns>
                    <asp:TemplateField HeaderText="" ItemStyle-Width="20">
                        <ItemTemplate><asp:CheckBox ID="cbxItem" runat="server" CssClass="cbxItem" /></ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="STT" ItemStyle-Width="20">
                        <ItemTemplate><%#Container.DataItemIndex+1 %></ItemTemplate>
                    </asp:TemplateField>    
                    <asp:BoundField HeaderText="Tiêu đề" DataField="Title" />                                    
                    <asp:TemplateField HeaderText="Chuyên mục">                    
                        <ItemTemplate><%#list_category_of_post(int.Parse(Convert.ToString(Eval("PostID")))) %></ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Ngôn ngữ">
                        <ItemTemplate><%#display_language(Convert.ToString(Eval("LangID"))) %></ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Ngày tạo">
                        <ItemTemplate><%#DisplayDateTime(Convert.ToString(Eval("CreateDate"))) %></ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Trạng thái">
                        <ItemTemplate><%#display_status(Convert.ToString(Eval("Status"))) %></ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Thao tác" ItemStyle-Width="60">
                        <ItemTemplate>
                            <a href='/admin/post-new.aspx?post_type=<%#Eval("Type") %>&p=<%#Eval("PostID") %>' class="btnEdit">
                            Sửa</a>
                            <asp:LinkButton ID="lbtDelete" runat="server" CssClass="btnDelete" Text="Xóa" CommandName="Delete" CommandArgument='<%#Eval("PostID") %>'></asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
            <div class="pagenav">
                <Pagging:PaggingControl runat="server" ID="ctlPagging" Mode="Url" PageSize="20"
                PreviousClause="<img src='../images/Back.png'/>" NextClause="<img src='../images/Forward.png'/>" />
            </div>            
            <div class="function">
                    <asp:DropDownList ID="ddlFunctionBottom" runat="server" CssClass="select">
                        <asp:ListItem Selected="True" Text="Chọn thao tác" Value="0"></asp:ListItem>
                        <asp:ListItem Text="Xóa" Value="delete"></asp:ListItem>
                    </asp:DropDownList>
                    <asp:LinkButton ID="lbtFunctionBottom" runat="server" Text="Thực hiện" CssClass="link-btn" CommandName="BunkFunction" OnCommand="lbtFunction_Click" CommandArgument="BottomFunction"></asp:LinkButton>	            
            </div>                                                        
        </div>
    </div>
</asp:Content>
